﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using NCLCustomerManagement.DataTransferObjects.History;
using NCLCustomerManagement.UI.Controllers;
using NCLCustomerManagement.UI.Models.User;

namespace NCLCustomerManagement.UI.Helper
{
    //public class LogAttribute : ActionFilterAttribute
    //{
    //    public string Action { get; set; }
    //    public HistoryType Type { get; set; }
    //    private AuthenticatedUser CurrentLoginUser { get; set; }

    //    public override void OnActionExecuted(ActionExecutedContext filterContext)
    //    {
            
    //        var controller = (filterContext.Controller as BaseController);
            
    //        //if (filterContext.ActionDescriptor.ActionName!="Logout")
    //        {
    //            this.CurrentLoginUser = controller.GetCurrentUser();
    //        }

    //        if (this.CurrentLoginUser != null)
    //        {
    //            controller.HistoryBC.AddHistory(new HistoryDTO()
    //            {
    //                Id = Guid.NewGuid(),
    //                Username = this.CurrentLoginUser.Username,
    //                Operation = Action,
    //                OperationDate = DateTime.Now,
    //                Type = this.Type
    //            });
    //        }
    //        base.OnActionExecuted(filterContext);
    //    }

       
    //}
}